﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:reader="clr-namespace:MishraReader.ViewModels.Reader;assembly=MishraReader.ViewModels"
                    xmlns:mishraReader="clr-namespace:MishraReader;assembly=MishraReader.ViewModels">
    <DataTemplate DataType="{x:Type reader:ShareViewModel}">
        <StackPanel Width="500" FocusManager.FocusedElement="{Binding ElementName=txtMessage}">

            <TextBlock IsHitTestVisible="False" Style="{StaticResource MetroHeader1}" Foreground="{DynamicResource MetroAccentBrush}">
            <Run Text="{x:Static mishraReader:Strings.Share2}" />
            <Run Text="{Binding Item.Title, Mode=OneWay}" />
            <Run Text="»" />
            </TextBlock>

            <Grid Margin="0,30,0,0">
                <StackPanel>
                    <TextBox Height="100" x:Name="txtMessage" Style="{StaticResource ShareTextBox}" Text="{Binding Message, UpdateSourceTrigger=PropertyChanged}" AcceptsReturn="True" TextWrapping="Wrap" AcceptsTab="True" MaxLength="500" />
                </StackPanel>

            </Grid>

            <Grid Margin="0,30,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <TextBlock Text="{x:Static mishraReader:Strings.ShareOn}" />


                <ItemsControl Grid.Column="1"  Margin="10,0,-20,-20"  ItemsSource="{Binding ActivatedServices}" HorizontalAlignment="Left">
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <WrapPanel />
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <CheckBox Style="{StaticResource MetroImageCheckBox}" IsChecked="{Binding IsActivated}" Margin="0,0,20,20">
                                <Grid Width="100" Height="100" Background="{StaticResource MetroTextLight}">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="*" />
                                        <RowDefinition Height="Auto" />
                                    </Grid.RowDefinitions>
                                    <Image Stretch="None" Source="{Binding ServiceLogo}" VerticalAlignment="Center" HorizontalAlignment="Center" />
                                    <Grid Grid.Row="1">
                                        <Rectangle Fill="{DynamicResource MetroAccentBrush}" Grid.Row="1" />
                                        <TextBlock Text="{Binding ServicePackage.ServiceName, FallbackValue=[name]}" Margin="5,6,5,6" HorizontalAlignment="Center" Style="{DynamicResource MetroNormalText}" Foreground="{DynamicResource MetroHeadingColorLight}"/>
                                    </Grid>
                                </Grid>
                            </CheckBox>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>

                <TextBlock Grid.Row="1" Grid.ColumnSpan="2" Margin="0,0,0,0" HorizontalAlignment="Right">
                    <Hyperlink Command="{Binding SettingsCommand}">
                        <Run Text="{x:Static mishraReader:Strings.ConfigureShareServices}" />
                    </Hyperlink>
                </TextBlock>

            </Grid>

            <StackPanel Margin="0,30,0,0" Orientation="Horizontal" HorizontalAlignment="Right">
                <Button Content="{x:Static mishraReader:Strings.ShareBig}" Command="{Binding ShareCommand}" Style="{StaticResource MetroAccentButton}" Margin="10,0,0,0" />
                <Button Content="{x:Static mishraReader:Strings.Cancel}" IsCancel="True" Margin="10,0,0,0"/>
            </StackPanel>
        </StackPanel>
    </DataTemplate>
</ResourceDictionary>